<template>
  <div class="dashboard">
    <div class="search">
      <HyTable :tableItems="tableItems" :tableData="tableData">
        <template #status="scope">{{
          scope.row.enable == '1' ? '可用' : '禁用'
        }}</template>
      </HyTable>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { HyTable, ITableItem } from '@/base-ui/table/index'

export default defineComponent({
  name: 'dashboard',
  components: { HyTable },
  setup() {
    const tableItems: ITableItem[] = [
      {
        prop: 'name',
        label: '用户名',
        minWidth: 180,
      },
      {
        prop: 'realname',
        label: '真实姓名',
        minWidth: 180,
      },
      {
        prop: 'cellphone',
        label: '手机号码',
        minWidth: 180,
      },
      {
        prop: 'enable',
        label: '状态',
        minWidth: 180,
        slotName: 'status',
      },
      {
        prop: 'address',
        label: '地址',
        minWidth: 200,
      },
      {
        prop: 'createAt',
        label: '创建时间',
        minWidth: 180,
        slotName: 'createAt',
      },
      {
        prop: 'updateAt',
        label: '更新时间',
        minWidth: 180,
        slotName: 'updateAt',
      },
    ]
    const tableData = [
      {
        name: 'Tom',
        realname: '汤姆',
        cellphone: '18570728781',
        enable: '0',
        address: 'No. 189, Grove St, Los Angeles',
      },
      {
        name: 'Tom',
        realname: '汤姆',
        cellphone: '18570728781',
        enable: '1',
        address: 'No. 189, Grove St, Los Angeles',
      },
      {
        name: 'Tom',
        realname: '汤姆',
        cellphone: '18570728781',
        enable: '0',
        address: 'No. 189, Grove St, Los Angeles',
      },
      {
        name: 'Tom',
        realname: '汤姆',
        cellphone: '18570728781',
        enable: '1',
        address: 'No. 189, Grove St, Los Angeles',
      },
    ]
    return { tableItems, tableData }
  },
})
</script>

<style scoped></style>
